package sg.edu.nus.iss.umpire.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Competition implements Serializable{

	private static final long serialVersionUID = -7930777679663524090L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long key;
	
	private String name;
	private Date startDate;
	private Date endDate;
	private String location;
	private Long refereeKey;
	private String refereeName;
	@OneToMany(cascade = CascadeType.ALL)
	private List<CompetitionDay> competitionDays = new ArrayList<CompetitionDay>();
	public Long getKey() {
		return key;
	}

	public void setKey(Long key) {
		this.key = key;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}

	public Long getRefereeKey() {
		return refereeKey;
	}

	public void setRefereeKey(Long refereeKey) {
		this.refereeKey = refereeKey;
	}
	public String getRefereeName() {
		return refereeName;
	}
	public void setRefereeName(String refereeName) {
		this.refereeName = refereeName;
	}
	
	
	public List<CompetitionDay> getCompetitionDays() {
		return competitionDays;
	}

	public void setCompetitionDays(List<CompetitionDay> competitionDays) {
		this.competitionDays = competitionDays;
	}

	@Override
	public String toString() {
		return "Competition [competitionKey=" + key + ", name="
				+ name + ", startDate=" + startDate + ", endDate=" + endDate
				+ ", location=" + location + ", refereeKey=" + refereeKey
				+ ", refereeName=" + refereeName + "]";
	}
}
